#!/bin/bash
#vfat file order

#create 100 random numbered files of 4 digit length
for i in `seq 1 100`;do touch $(($RANDOM%9000+1001));done

#use find and you  will find them to be in a non sequential order
find

#this is what we want
find|sort

#touch does not work because it's not a timestamp thing, it's the order the files are written to the device
find|sort|while read i;do touch "$i";done

#use fatsort
#install fatsort
sudo aptitude install fatsort

#unmount the drive then run fatsort on the partition
sudo fatsort /dev/sdX1